<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>判断质数</title>
</head>
<body>
    <script>
        function isPrime(num) {
            for (let i = 2; i < num; i++) {
                if (num % i === 0){
                    return false;
                }
            }
            return true;
        }

        alert(isPrime(1));
        alert(isPrime(2));
        alert(isPrime(9));

    </script>
</body>
</html>